package com.example.loop.configuration.rabbitMq;

import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.QueueBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 创建rabbitMq的交换机和队列的类
 *
 * @author Liaorun
 */
@Configuration
public class RabbitMqExchangerAndQueueConfig {

    @Bean
    public DirectExchange directExchange() {
        return new DirectExchange("simple.direct", true, false);
    }

    @Bean
    public Queue queue() {
        return QueueBuilder.durable("simple.queue1")
                .build();
    }
}
